package com.nop.ui.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.UIObject;
import com.nop.ui.client.datasources.MdpUsersDataSource;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.layout.Layout;

public class Main implements EntryPoint
{
	
	/**
	 * GWT Module EntryPoint
	 */
	public void onModuleLoad()
	{
		
		Layout mainObj = new Layout();
		
		DynamicForm dynamicForm = new DynamicForm();
		TextItem textItem = new TextItem( "name", "title" );
		dynamicForm.setItems( textItem );
		
		ListGrid listGrid = new ListGrid();
		listGrid.setAutoFetchData( false );
		listGrid.setDataSource( new MdpUsersDataSource().getDataSource() );
		listGrid.setHeight100();
		listGrid.setWidth100();
		listGrid.setAlternateRecordStyles( true );
		listGrid.fetchData();
		
		mainObj.setMembers( dynamicForm, listGrid );
		
		// Remove loading message
		UIObject.setVisible( RootPanel.get( "loading" ).getElement(), false );
		mainObj.draw();
		
	}
	
}
